package com.example.administrator.appli;

import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;

import com.example.administrator.appli.dialog.HandlerDialog2;

import java.util.Timer;
import java.util.TimerTask;

public class MainActivity2 extends Activity {



   private Handler mHandler=new Handler(){
        @Override
        public void handleMessage(Message msg) {
            super.handleMessage(msg);
            handlerDialog2.upData();
        }
    };
    HandlerDialog2 handlerDialog2;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main2);
        findViewById(R.id.tv_main2).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                handlerDialog2 = new HandlerDialog2(MainActivity2.this);
                handlerDialog2.show();
                Timer timer = new Timer();
                timer.schedule(new TimerTask() {
                    @Override
                    public void run() {
                        mHandler.sendEmptyMessage(100);
                    }
                }, 2000, 2000);
            }
        });


    }
}
